package cn.melon.view.admin.dorm.ctr;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import cn.melon.mod.dorm.DormInfo;
import cn.melon.mod.dorm.DormRequest;
import cn.melon.view.admin.dorm.DormInfoDlg;
import cn.melon.view.admin.dorm.IUpdateDormTable;

public class DormInfoDlgCtr implements ActionListener {

    private DormInfoDlg dialog = null;
    private DormRequest request;
    
    public DormInfoDlgCtr(DormInfoDlg dig, IUpdateDormTable updateBookTable){
        this.dialog = dig;
        request = new DormRequest(updateBookTable);
    }
    
    @Override
    public void actionPerformed(ActionEvent e) {
        System.out.println("In DormInfoDlg");
        switch (e.getActionCommand()) {
        case "保存":
            DormInfo dormInfo = dialog.getDormInfo();
            dialog.setVisible(false);
            request.updateDormInfo(dormInfo);
            break;
        case "取消":
            dialog.setVisible(false);
            break;
        default:
            break;
        }

    }

}
